/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;

/**
 * <p>Project: jse2303 - MyReader</p>
 * <p>Powered by webrx On 2023-07-26 11:39:30</p>
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class MyReader implements Runnable {
    private Socket c;
    private BufferedReader br;

    public MyReader(Socket c) {
        this.c = c;
        try {
            this.br = new BufferedReader(new InputStreamReader(c.getInputStream()));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public Socket getC() {
        return c;
    }

    public void setC(Socket c) {
        this.c = c;
    }

    public BufferedReader getBr() {
        return br;
    }

    public void setBr(BufferedReader br) {
        this.br = br;
    }

    public MyReader() {
    }

    @Override
    public void run() {
        while (true) {
            try {
                System.out.println(this.br.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
